package coml.jiyun.hp.gjtk_e.adapter;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;
import coml.jiyun.hp.gjtk_e.bean.TabBean;


import java.util.ArrayList;

public class TabAdapter extends FragmentPagerAdapter {
    private ArrayList<Fragment> fragments;
    private ArrayList<TabBean.DataBean> beans;

    public TabAdapter(@NonNull FragmentManager fm, ArrayList<Fragment> fragments, ArrayList<TabBean.DataBean> beans) {
        super(fm);
        this.fragments = fragments;
        this.beans = beans;
    }

    @NonNull
    @Override
    public Fragment getItem(int position) {
        return fragments.get(position);
    }

    @Override
    public int getCount() {
        return beans.size();
    }

    @Nullable
    @Override
    public CharSequence getPageTitle(int position) {
        return beans.get(position).getName();
    }
}
